//#include<bits/stdc++.h>
#include <iostream>
#include<algorithm>
#include<string>

typedef unsigned long long ull;
using namespace std;


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	string s;
	getline(cin, s);
	int maxLen = 1;
	int len = s.size();
	for (int i = 0;i < len;i++) {
		for (int j = len - 1;j > i;j--) {
			if (s[i] == s[j]) {
				for (int k = i + 1, l = j - 1;k < l;k++, l--) {
					if (s[k] != s[l])
						goto end;
				}
				maxLen = maxLen > (j - i+1) ? maxLen : (j - i+1);
			end:;
			}
		}
	}
	cout << maxLen << endl;
	return 0;
}